import Vue from "vue";
import Vuex from "vuex";
import createLogger from "vuex/dist/logger";
import createPersistedState from "vuex-persistedstate"
// 引入自模块
import article from './modules/article'
import archives from './modules/archives'
import login from './modules/login'
// 引入知识小册请求数据的模块
import knowledge from "./modules/knowledge"
import about from './modules/about'
Vue.use(Vuex)

const plugins = process.env.NODE_ENV !== 'production' ? [
  //日志
  createLogger(),
  // 数据持久化
  createPersistedState({
    storage: window.sessionStorage
  })
] : []

export default new Vuex.Store({
  modules: {
    article,
    archives,
    knowledge,
    about,
    login
  },
  plugins
});
